﻿using System;
using System.Collections.Generic;
using System.Data;

namespace BLL.Common
{
   public class DWS_RESOURCEITEM_INFO
    {
    private readonly OracleDAL.Common.DWS_RESOURCEITEM_INFO dal=new OracleDAL.Common.DWS_RESOURCEITEM_INFO();
		public DWS_RESOURCEITEM_INFO()
		{}
		#region  成员方法
		/// <summary>
		/// 是否存在该记录
		/// </summary>
        public bool Exists(string DWS_RESOURCEID, string DWS_RESOURCENAME, string DWS_RESOURCESTATUS, DateTime RECORDTIME, string DWS_REMARK, string DWS_IP, string DWS_DEPARTMENT, string DWS_DESCRIPTION)
        {
            return dal.Exists(DWS_RESOURCEID);
        }


		/// <summary>
		/// 增加一条数据
		/// </summary>
		public void Add(Model.Common.DWS_RESOURCEITEM_INFO model)
		{
			dal.Add(model);
		}

		/// <summary>
		/// 更新一条数据
		/// </summary>
		public void Update(Model.Common.DWS_RESOURCEITEM_INFO model)
		{
			dal.Update(model);
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
        public void Delete(string DWS_RESOURCEID)
		{

            dal.Delete(DWS_RESOURCEID);
		}

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
        public Model.Common.DWS_RESOURCEITEM_INFO GetModel(string DWS_RESOURCEID, DateTime RECORDTIME)
		{

            return dal.GetModel(DWS_RESOURCEID, RECORDTIME);
		}


		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			return dal.GetList(strWhere);
		}
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<Model.Common.DWS_RESOURCEITEM_INFO> GetModelList(string strWhere)
		{
			DataSet ds = dal.GetList(strWhere);
			return DataTableToList(ds.Tables[0]);
		}
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<Model.Common.DWS_RESOURCEITEM_INFO> DataTableToList(DataTable dt)
		{
			List<Model.Common.DWS_RESOURCEITEM_INFO> modelList = new List<Model.Common.DWS_RESOURCEITEM_INFO>();
			int rowsCount = dt.Rows.Count;
			if (rowsCount > 0)
			{
				Model.Common.DWS_RESOURCEITEM_INFO model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Model.Common.DWS_RESOURCEITEM_INFO();
                    model.DWS_RESOURCEID = dt.Rows[n]["DWS_RESOURCEID"].ToString();
                    model.DWS_RESOURCENAME = dt.Rows[n]["DWS_RESOURCENAME"].ToString();
                    model.DWS_RESOURCESTATUS = dt.Rows[n]["DWS_RESOURCESTATUS"].ToString();
                    if (dt.Rows[n]["RECORDTIME"].ToString() != "")
                    {
                        model.RECORDTIME = DateTime.Parse(dt.Rows[n]["RECORDTIME"].ToString());
                    }
                    model.DWS_REMARK = dt.Rows[n]["DWS_REMARK"].ToString();
                    model.DWS_IP = dt.Rows[n]["DWS_IP"].ToString();
                    model.DWS_DEPARTMENT = dt.Rows[n]["DWS_DEPARTMENT"].ToString();
                    model.DWS_DESCRIPTION = dt.Rows[n]["DWS_DESCRIPTION"].ToString();
                    modelList.Add(model);
                }
			}
			return modelList;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetAllList()
		{
			return GetList("");
		}
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllListInfo()
        {
            return dal.GetListInfo();
        }
		/// <summary>
		/// 获得数据列表
		/// </summary>
		//public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		//{
			//return dal.GetList(PageSize,PageIndex,strWhere);
		//}

		#endregion  成员方法
	}
}

